package com.tengju.bff.interfaces.app.announcement.assembler;


import com.tengju.bff.interfaces.app.announcement.vo.AnnounceArticleVO;
import com.tengju.support.domain.model.article.Article;
import com.tengju.user.domain.shared.DateUtil;

public class AnnounceArticleAssembler {

    public static AnnounceArticleVO modelToVO(Article article,String prefixURL) {
        if (article == null) {
            return null;
        }

        return new AnnounceArticleVO(
                article.getArticleId().getValue(),
                article.getTitle(),
                String.format("%s?id=%s",prefixURL,article.getArticleId().getValue()),
                DateUtil.formartLocalDateTime(DateUtil.DATE_DAY_FORMAT,article.getCreateTime())
                );
    }
}
